package com.agileai.pm.module.base.service;

import java.util.Date;
import java.util.List;

import com.agileai.domain.DataParam;
import com.agileai.domain.DataRow;
import com.agileai.hotweb.bizmoduler.core.StandardServiceImpl;

public class ProjectTestManageImpl
        extends StandardServiceImpl
        implements ProjectTestManage {
    public ProjectTestManageImpl() {
        super();
    }
    public List<DataRow> findFileTestSchemeRecord(DataParam param) {
		String statementId = sqlNameSpace+"."+"findFileTestSchemeRecord";
		List<DataRow> result = this.daoHelper.queryRecords(statementId, param);
		return result;
	}
    
    public void updateSubmitTestSchemeRecord(String testSchemeId,String userId,Date releaseTime) {
		String submitState = "SUBMIT";
		String statementId = sqlNameSpace+"."+"updateSubmitTestSchemeRecord";
		DataParam param = new DataParam();
		param.put("PT_ID",testSchemeId);
		param.put("PT_STATE",submitState);
		param.put("PT_PUBLISHER",userId);
		param.put("PT_PUBL_TIME",releaseTime);
		this.daoHelper.updateRecord(statementId, param);
	}
    
    public void updateFileTestSchemeRecord(String testSchemeId) {
		String fileState = "FILE";
		String statementId = sqlNameSpace+"."+"updateFileTestSchemeRecord";
		DataParam param = new DataParam();
		param.put("PT_ID",testSchemeId);
		param.put("PT_STATE",fileState);
		this.daoHelper.updateRecord(statementId, param);
	}
    
    public void updateExtractDefectRecord(String key) {
		String statementId = sqlNameSpace+"."+"updateExtractDefectRecord";
		DataParam param = new DataParam();
		param.put("TPD_ID",key);
		this.daoHelper.updateRecord(statementId, param);
	}
    
    public List<DataRow> findNotCompleteDefectRecord(String testSchemeId) {
    	DataParam param = new DataParam("PT_ID",testSchemeId);
		String statementId = sqlNameSpace+"."+"findNotCompleteDefectRecord";
		List<DataRow> result = this.daoHelper.queryRecords(statementId, param);
		return result;
	}
    
    public void insertNotCompleteDefectRecord(DataParam param) {
		String statementId = sqlNameSpace+"."+"insertNotCompleteDefectRecord";
		processDataType(param, tableName);
		this.daoHelper.insertRecord(statementId, param);
	}	
    
    public DataRow getSubmitState(String projectId) {
    	DataParam param = new DataParam("PI_ID",projectId);
		String statementId = sqlNameSpace+"."+"getSubmitState";
		DataRow result = this.daoHelper.getRecord(statementId,param);
		return result;
	}
    
    public DataRow getSubmitStateRecords(String projectId) {
    	DataParam param = new DataParam("PI_ID",projectId);
		String statementId = sqlNameSpace+"."+"getSubmitStateRecords";
		DataRow result = this.daoHelper.getRecord(statementId,param);
		return result;
	}
}
